<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet"  type="text/css"  href="/lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/userlist.css">
</head>
<body>
<div class="userslist-wrapper" style="padding: 0 30px 0 30px">
    <div >
        <ul class="nav nav-tabs" role="tablist">
            {if condition="$type eq 0"}
                <li role="presentation" class="active"><a href="{:url('users/indexs', ['type' => 0])}" >所有账号 <i>({$list.all})</i></a></li>
                <li role="presentation"><a href="{:url('users/indexs', ['type' => 1])}" >可用账号 <i>({$list.is_use})</i></a></li>
                <li role="presentation"><a href="{:url('users/indexs', ['type' => 2])}" >禁用账号<i>({$list.is_no_use})</i></a></li>
            {elseif condition="$type eq 1"}
                <li role="presentation" ><a href="{:url('users/indexs', ['type' => 0])}" >所有账号 <i>({$list.all})</i></a></li>
                <li role="presentation" class="active"><a href="{:url('users/indexs', ['type' => 1])}" >可用账号 <i>({$list.is_use})</i></a></li>
                <li role="presentation"><a href="{:url('users/indexs', ['type' => 2])}" >禁用账号<i>({$list.is_no_use})</i></a></li>
            {elseif condition="$type eq 2"}
                <li role="presentation"><a href="{:url('users/indexs', ['type' => 0])}" >所有账号 <i>({$list.all})</i></a></li>
                <li role="presentation"><a href="{:url('users/indexs', ['type' => 1])}" >可用账号 <i>({$list.is_use})</i></a></li>
                <li role="presentation"  class="active"><a href="{:url('users/indexs', ['type' => 2])}" >禁用账号<i>({$list.is_no_use})</i></a></li>
            {/if}
        </ul>
        <div class="row " style="padding: 30px 0">
            <form class="col-sm-12 form-inline" action = "{:url('users/select')}" method = "post">
                <button type="button" class="btn btn-default" data-toggle="modal" data-target="#add-user" data-whatever="@mdo"><span class="glyphicon glyphicon-plus"></span>添加用户</button>
                <input type="text" class="form-control search"  placeholder="用户名" name = "username"> <input type = "submit" value = "搜索" id="submit" class="btn btn-default" >
                <a  class="btn btn-default " href="" ><span class="glyphicon glyphicon-repeat">刷新-共<i>
                        {if $type eq 0}
                        {$list.all}
                        {elseif $type eq 1 }
                        {$list.is_use}
                        {elseif $type eq 2}
                        {$list.is_no_use}
                        {/if}
                    </i>条记录</span> </a>
            </form>
           </div>
        <div class="tab-content" style="margin-top: 20px">
            <div role="tabpanel" class="tab-pane active" id="alluser">
                <form action="">
                <table class="table "style="text-align: center">
                    <thead style="border: 1px solid #BBBBBB;background-color:#eeeeee;" >
                        <tr style="border: 1px solid #BBBBBB">
                            <td>用户名</td>
                            <td>手机号</td>
                            <!--<td>联豆数量</td>-->
                            <td>昵称</td>
                            <td>创建时期</td>
                            <td>状态</td>
                            <td>备注</td>
                            <td>操作</td>

                        </tr>
                    </thead>
                    <tbody>
                        {volist name = 'result' id = 'value'}
                        <tr>
                            <td>
                                <span class="username">{$value.username}</span>
                            </td>
                            <td class="phonenum">{$value.iphone}</td>
                            <!--<td class="phonenum">{$value.beans}</td>-->
                            <td class="phonenum">{$value.name }</td>
                            <td class="create-date">
                                {$value.create_time}
                            </td>
                            <td class="zt able " style="width: 100px">
                                {if $value.is_use == '0'}
                                <span class="text-success">可用</span>
                                {else}
                                <span  class="text-danger">禁用</span>
                                {/if}
                            </td>
                            <td><input type="text" class="Remarks" value="{$value.remarks}"/></td>
                             <td width="200px">
                                <ul>
                                    <li>
                                        <a href="{:url('users/details', ['user_id' => $value.id])}" class="btn btn-default btn-xs">详情</a>
                                        <!--<a type="button" class="btn btn-default btn-xs user-edit" data-toggle="modal" data-target="#user-edit" > 编辑</a></li>-->
                                        <!--<a type="button" class="btn btn-default btn-xs recoverpasswd" data-toggle="modal" data-target="#modifyPassword" id="repasswdBtn">修改密码</a></li>-->
                                    <li>
                                        {if $value.is_use == '0'}
                                        <a href="{:url('users/delete', ['user_id' => $value.id, 'is_use' => $value.is_use])}" class="btn btn-danger btn-xs del" id="del">禁用</a>
                                        {else if($value.is_use == '1')}
                                        <a href="{:url('users/delete', ['user_id' => $value.id, 'is_use' => $value.is_use])}" class="btn btn-info btn-xs recover" id="recover" >恢复</a>
                                        {/if}
                                    </li>
                                </ul>
                            </td>
                        </tr>
                        {/volist}
                    </tbody>
                </table>
                </form>
            </div>
            <div role="tabpanel" class="tab-pane" id="usable-users">
                <form action="">
                    <table class="table "style="text-align: center">
                        <thead style="border: 1px solid #BBBBBB;background-color:#eeeeee;" >
                        <tr style="border: 1px solid #BBBBBB">
                            <td>账号ID</td>
                            <td>用户名</td>
                            <td>手机号</td>
                            <td>创建时期</td>
                            <td>状态</td>
                            <td>操作</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>
                                <span id="user">2048</span>
                            </td>
                            <td>
                                <span class="username">2048</span>
                            </td>
                            <td id="phone">15015426852</td>
                            <td class="create-date">
                                2017-05-26 10:25
                            </td>
                            <td class="tongguo">
                                可用
                            </td>

                            <td>
                                <ul>

                                    <li>
                                        <!--<a type="button" class="btn btn-default btn-xs " data-toggle="modal" data-target="#user-edit" >编辑</a></li> -->
                                    <li><a href="javascript:;" class="btn btn-default btn-xs">修改密码</a></li>
                                    <li><a href="javascript:;" class="btn btn-default btn-xs">日志</a></li>
                                    <li><a href="javascript:;" class="btn btn-default btn-xs">删除</a></li>
                                </ul>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <div role="tabpanel" class="tab-pane" id="disableuser">
                <form action="">
                    <table class="table "style="text-align: center">
                        <thead style="border: 1px solid #BBBBBB;background-color:#eeeeee;" >
                        <tr style="border: 1px solid #BBBBBB">
                            <td>账号ID</td>
                            <td>用户名</td>
                            <td>手机号</td>
                            <td>创建时期</td>
                            <td>状态</td>
                            <td>操作</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>
                                <span>2048</span>
                            </td>
                            <td>
                                <span class="username">2048</span>
                            </td>
                            <td>15015426852</td>
                            <td class="create-date">
                                2017-05-26 10:25
                            </td>
                            <td class="tongguo">
                                可用
                            </td>

                            <td>
                                <ul>
                                    <!--<li><a href="javascript:;" class="btn btn-default btn-xs" >编辑</a></li> -->
                                    <li><a href="javascript:;" class="btn btn-default btn-xs">修改密码</a></li>
                                    <li><a href="javascript:;" class="btn btn-default btn-xs">日志</a></li>
                                    <li><a href="javascript:;" class="btn btn-default btn-xs">删除</a></li>
                                </ul>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <div role="tabpanel" class="tab-pane" id="Cancellation"> <form action="">
                <table class="table "style="text-align: center">
                    <thead style="border: 1px solid #BBBBBB;background-color:#eeeeee;" >
                    <tr style="border: 1px solid #BBBBBB">
                        <td>账号ID</td>
                        <td>用户名</td>
                        <td>手机号</td>
                        <td>创建时期</td>
                        <td>状态</td>
                        <td>操作</td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>
                            <span>2048</span>
                        </td>
                        <td>
                            <span class="username">2048</span>
                        </td>
                        <td>15015426852</td>
                        <td class="create-date">
                            2017-05-26 10:25
                        </td>
                        <td class="tongguo">
                            可用
                        </td>

                        <td>
                            <ul>
                               <!-- <li><a href="javascript:;" class="btn btn-default btn-xs" >编辑</a></li> -->
                                <li><a href="javascript:;" class="btn btn-default btn-xs">修改密码</a></li>
                                <li><a href="javascript:;" class="btn btn-default btn-xs">日志</a></li>
                                <li><a href="javascript:;" class="btn btn-default btn-xs">删除</a></li>
                            </ul>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </form></div>
        </div>
        <nav>
            {$page}
        </nav>
    </div>
</div>
<!--添加用户模态框start-->
<div class="modal fade" id="add-user" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="exampleModalLabel" style="text-align: center;font-size: 14px;font-weight: bold" >添加账户</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action = "{:url('users/insert')}" method="post">
                    <div class="form-group">
                        <label for="phone-number" class="col-sm-3 control-label">手机号：</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="phone-number" placeholder="请输入手机号" name = "username">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="password" class="col-sm-3 control-label">密  码：</label>
                        <div class="col-sm-7">
                            <input type="password" class="form-control" id="password" placeholder="请输入密码" name = "pwd">
                        </div>
                    </div>
                    <div class="modal-footer">
                    <button type="submit" class="btn btn-primary" id="save">保存</button>
                </div>
                </form>
        </div>
    </div>
</div>
</div>
<!--添加用户模态框end-->

<!--编辑用户模态框start-->
<div class="modal fade" id="user-edit" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" >账户编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal"  action = "{:url('users/update')}" method = "post">
                   <!-- <div class="form-group row">
                        <label for="edit-user-id" class="col-sm-3 control-label">账号ID:</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="edit-user-id" placeholder="请输入用户ID">
                        </div>
                    </div>-->
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">账号ID：</label>
                        <div class="col-sm-7">
                            <input type="hidden" class="form-control userID"   name="username">
                            <span class="usertext"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="edit-user-name" class="col-sm-3 control-label">昵称：</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="edit-user-name" placeholder="请输入用户名" name="name">
                        </div>
                        <label for="edit-user-name" class="col-sm-3 control-label">联豆数量:</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="edit-user-name" placeholder="请输入联豆数量" name="beans">
                        </div>
                    </div>
                  <!--  <div class="form-group " style="display: none" id="disableWrapper">
                        <label  class="col-sm-3 control-label">禁用时间：</label>
                        <div class="col-sm-7">
                            <label><input type="text" class="form-control" placeholder="请输入禁用时间（天）"></label>
                        </div>
                    </div>-->
            <div class="modal-footer">
                <button type="submit" class="btn  btn-primary">保存</button>
            </div>
            </form>
        </div>
    </div>
</div>
</div>
<!--编辑用户模态框end-->

<!--修改密码modal start-->

<div class="modal fade" id="modifyPassword" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" >修改密码</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal"  action = "{:url('users/updatePassword')}" method="post">
                  <!--  <div class="form-group row">
                        <label  class="col-sm-3 control-label">账号ID:</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control"  placeholder="用户ID">
                        </div>
                    </div>-->
                     <div class="form-group">
                        <label  class="col-sm-3 control-label" >用户名：</label>
                        <div class="col-sm-7">
                            <input type="hidden" id="reuserName" name = "username">
                            <label  class="col-sm-7 reuserName" ></label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label" >手机号：</label>
                        <div class="col-sm-7">
                            <input type="hidden"  id="phoneNum">
                            <label  class="col-sm-7 Phonenum">20105485558</label>
                        </div>
                       <!-- <a href="javascript:;" class="col-sm-3" style="vertical-align: middle">发送验证码</a>-->
                    </div>
                   <!-- <div class="form-group">
                        <label  class="col-sm-3 control-label">验证码：</label>
                        <div class="col-sm-7">
                            <label>
                                <input  class="form-control"   name="Fruit" type="text" placeholder="请输入验证码" /></label>
                        </div>
                    </div>-->
                    <div class="form-group " >
                        <label for="Mpassword" class="col-sm-3 control-label">更改密码：</label>
                        <div class="col-sm-7">
                            <input id="Mpassword" class="form-control" name="pwd" onblur="checkpas1();" required="true" type="password"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label" >确认密码：</label>
                        <div class="col-sm-7">
                            <input class="form-control" type="password" name="repassword" id="repassword" required="true" onChange="checkpas();" />
                        </div>
                    </div>

            <div class="alert alert-danger tip" role="alert">两次输入的密码不一致</div>
            <div class="modal-footer">
                <button type="submit" style="text-align: center" class="btn btn-info" onclick="checkpas2();">保存</button>
            </div>
             </form>
        </div>
    </div>
</div>
</div>

<!--修改密码 modal end-->

<!--<div class="aside-wrapper">
    <div>
        <span class="glyphicon glyphicon-zoom-in"></span>
        <div class="search-wrapper">

        </div>
    </div>
</div>-->

<!--高级搜索侧边栏 start-->



<!--高级搜索侧边栏 end-->
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="/js/userlist.js"></script>
<script>
    $(".Remarks").each(function (index,item) {
        var value="";
        $(this).focus(function () {
            value=$($(".Remarks").get(index)).val();
        });
        $(this).blur(function () {
            var valueafter=$($(".Remarks").get(index)).val();
            var user_id = $($(".username").get(index)).html();
            if(value!==valueafter){
                $.ajax({
                    url:"userRemarks",
                    data:{"remarks":valueafter,"username":user_id},
                    type:"post",
                    success:function (val) {

                    }
                })
            }
        })
    });
</script>
<script src="/js/nosearch.js"></script>

</body>
</html>